home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / LunarLander.swf / scripts / frame_4 / PlaceObject2_34_1 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Encoding:
Text File  |  2006-06-13  |  2.3 KB  |  110 lines

  1. onClipEvent(enterFrame){
  2.    if(999 < fuel)
  3.    {
  4.       fuel = 999;
  5.    }
  6.    if(landed)
  7.    {
  8.       if(timer == 0)
  9.       {
  10.          _root.lv = vel - 20;
  11.       }
  12.       timer++;
  13.       vel = 20;
  14.       xvel = 20;
  15.       if(20 < timer)
  16.       {
  17.          _root.scoreboard._visible = true;
  18.          timer = 0;
  19.          landed = false;
  20.       }
  21.    }
  22.    else if(dead)
  23.    {
  24.       _alpha = _alpha - 10;
  25.       if(0 >= _alpha)
  26.       {
  27.          if(1 < lives)
  28.          {
  29.             _alpha = 100;
  30.             _X = _root.levels[_root.gamelevel - 1][0];
  31.             _Y = _root.levels[_root.gamelevel - 1][1];
  32.             fuel = _root.levels[_root.gamelevel - 1][2] * _root.grav * 20 + 100;
  33.             lives--;
  34.             _rotation = 0;
  35.             xvel = 20;
  36.             vel = 20;
  37.             dead = false;
  38.             invincible = 15;
  39.          }
  40.          else
  41.          {
  42.             _root.end = true;
  43.             endtimer++;
  44.             if(100 < endtimer)
  45.             {
  46.                _root.gotoAndStop("menu");
  47.                _root.end = false;
  48.                endtimer = 0;
  49.             }
  50.          }
  51.       }
  52.    }
  53.    else
  54.    {
  55.       if(Key.isDown(221))
  56.       {
  57.          landed = true;
  58.          _root.nextlevel();
  59.       }
  60.       if(Key.isDown(Key.SPACE) && 0 < fuel)
  61.       {
  62.          thrust = true;
  63.       }
  64.       else
  65.       {
  66.          thrust = false;
  67.       }
  68.       if(Key.isDown(Key.RIGHT))
  69.       {
  70.          _rotation = _rotation + 4;
  71.       }
  72.       else if(Key.isDown(Key.LEFT))
  73.       {
  74.          _rotation = _rotation - 4;
  75.       }
  76.       if(thrust)
  77.       {
  78.          fuel -= 1;
  79.          vel -= 0.1;
  80.          vel -= 0.1 * Math.abs(vel - 20);
  81.          if(_rotation < 0)
  82.          {
  83.             xvel += _rotation / 900;
  84.             xvel -= 0.1 * Math.abs(xvel - 20);
  85.          }
  86.          else if(0 < _rotation)
  87.          {
  88.             xvel += _rotation / 900;
  89.             xvel += 0.1 * Math.abs(xvel - 20);
  90.          }
  91.       }
  92.       else
  93.       {
  94.          vel += grav;
  95.          vel += grav * Math.abs(vel - 20);
  96.       }
  97.       _Y = _Y + (vel - 20) / 2;
  98.       _X = _X + (xvel - 20) / 3;
  99.       if(800 + _width / 2 < _X)
  100.       {
  101.          _X = (- _width) / 2;
  102.       }
  103.       else if(_X < (- _width) / 2)
  104.       {
  105.          _X = 800 + _width / 2;
  106.       }
  107.       invincible--;
  108.    }
  109. }
  110.